*** Settings ***
Documentation    TC10-Round Management FCL-Sanity Check
Resource    ../../Keywords/Common_Head.robot
Resource    ../../Keywords/Common/Common_kw.robot
Force Tags    P3
Metadata    Author    Fiona
Metadata    ID    6855072

*** Variables ***
${TenderTitle}    Regression Test by automation
${G_TENDERID}    

*** Test Cases ***
TC10-Round Management FCL-Sanity Check
    Step 1 1 Create A Tender With Following Attributes
    Step 2 Use Attachment FCLTemplate Location_sanityCheck xlsx To
    Step 3 Click On Next Template Management Button
    Step 4 In Step2 Select And Define Optional Columns
    Step 5 Update The Container Type As 20DC In The Downloaded
    Step 6 Click On Skip Button In Step4 In The Pop Up Skip Push
    Step 7 Click On Next Round Management Button
    Step 8 Click On Sanity Check Button
    Step 9 Close The Validation Setup Dialog
    Step 10 Click On Start Button
    Step 11 Close The Window And Reopen It
    Step 12 Click On Download IPT Update The Rate Part In The File
    Step 13 Download The Error Report 1
    Step 14 Update The Rate Part In The File As Attachment index 1
    Step 15 Download The Error Report 2
    Step 16 Update The Rate Part In The File As Attachment index 2
    Step 17 Download The Error Report 3
    Step 18 Update The Rate Part In The File As Attachment index 3
    Step 19 Click On Submit Button
    Step 20 Exchange Current Role To Project Owner
    Step 21 Click On Close Button
    Step 22 Select This Project Click On Delete Project Button
    Step 23 User Goes To Basic Data Management Tender List



*** Keywords ***
Step ${step} 1 Create A Tender With Following Attributes
    #************************Step 1******************************
    #  Do:
    #      1 Create a tender with following attributes
    #      Tender ID some numbers such as 202408151435001 you can
    #     input with current datetime and some random number to
    #     avoid duplicate validation
    #      Tender Title some value such as Regression Test by
    #     Wendy001
    #      Mode FCL
    #      Deadline to TM current date 10 day
    #      Rate Validity From current date
    #      Rate Validity To current date 100 day
    #      Deputies NATZHANG
    #      Description for regression
    #      2 Create a project with following attributes
    #      Tender ID input as 1 created such as 202408151435001
    #     Regression Test by Wendy001
    #      Mode Air
    #      Deadline to TM one month after current date and time
    #      Rate validity from current date
    #      Rate validity to one month after current date
    #      Deputies NATZHANG
    #      Descrpition test by wendy for sanity check
    #  Expected:
    #      The project creates successfully
    #************************************************************
    Login Space
    # Set Browser Timeout    5s
    ${G_TENDERID}    Generate Tender ID
    Set Suite Variable    ${G_TENDERID}    ${G_TENDERID} 
    Create Tender    ${G_TENDERID}    ${TenderTitle}    815    true    true    true

    ${CurDate}    Get Current Date    result_format=%d/%m/%Y
    ${DealLineDate}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${FutureDate}    Get Current Date    UTC    +100days    result_format=%d/%m/%Y
    ${PROJECT}    Copy Dictionary    ${PROJECT_PARAM}
    Set To Dictionary    ${PROJECT}    
          ...    TENDER_ID=${G_TENDERID}    TENDER_TITLE=${TenderTitle}    CUSTOEMR_NAME=Miele    CUSTOMER_LEVEL=Global
          ...    MODE=FCL    DEADLINE_TM_DATE=${DealLineDate}    VALID_FROM=${CurDate}    VALID_TO=${FutureDate}    DEPUTY=NATZHANG
    Set Test Variable    ${PROJECT}    ${PROJECT}
    Create Project    ${PROJECT}


Step ${step} Use Attachment FCLTemplate Location_sanityCheck xlsx To
    #************************Step 2******************************
    #  Do:
    #      Use attachment FCLTemplate Location_sanityCheck xlsx to
    #     do data cleaning index php attachments get 82b0fc4d 84ec
    #     4644 b413 4a5b6a93efea
    #      Mapping Columns are
    #      Origin Country country from D
    #      Destination Country country to G
    #      Origin City city from C
    #      Destination City city to F
    #      Origin State state from E
    #      Destination State state to H
    #      Customer Lane ID Lane ID code B
    #      Origin Type Origin Type I
    #      Destination Type Des Type J
    #      Origin Postal Code Origin Postal Code K
    #      Destination Postal Code Destination Postal Code L
    #      Customer s Delivery Term Customer s Delivery Term M
    #      Customer Port of Load Customer Port of Load N
    #      Customer Port of Discharge Customer Port of Discharge O
    #      Volume Containers 20 Volume Containers 20 P
    #      Volume Containers 40 Volume Containers 40 Q
    #      Volume Containers 40HC Volume Containers 40HC R
    #      Volume Containers 45 Volume Containers 45 S
    #      Volume TEU Total Volume TEU Total T
    #      Commodity Description Commodity Description U
    #      Commodity Remarks Commodity Remarks W
    #      IMO Class IMO Class V
    #      IMO UN No IMO UN No W
    #      Click on Start button
    #  Expected:
    #      Summary Successful
    #      Please close this page and go to Generate Internal
    #     Pricing Template
    #************************************************************
    ${DCTemplateFile}    Set Variable    Cases${/}FCL MODE${/}${/}TestData${/}FCLTemplate-Location_sanityCheck.xlsx
    Set Test Variable    ${DCTemplateFile}    ${DCTemplateFile}
    Data Cleaning_TC10    Location    ${DCTemplateFile}

Step ${step} Click On Next Template Management Button
    #************************Step 3******************************
    #  Do:
    #      Click on Next Template Management button
    #  Expected:
    #      The Template Management window is pop up
    #************************************************************
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Template_gotoNextButton}

Step ${step} In Step2 Select And Define Optional Columns
    #************************Step 4******************************
    #  Do:
    #      In Step2 Select and Define Optional Columns
    #      Select all of the check boxes except the TBN columns
    #      Click Start button in Step 3
    #  Expected:
    #      100
    #      Summary
    #      2 lanes have been generated in your internal pricing
    #     template
    #      If you want to change some columns please repeat step 2
    #     and step 3 Container Type is mandatory Please upload to
    #     continue with next step
    #************************************************************
    Sleep    5
    Wait Until Search Finished
    Template Management_TC10

Step ${step} Update The Container Type As 20DC In The Downloaded
    #************************Step 5******************************
    #  Do:
    #      Update the container type as 20DC in the downloaded
    #     file such as
    #      index php attachments get b2e9cfea e9c9 4a58 930d
    #     1e9c60283304 Upload it
    #  Expected:
    #      Summary
    #      2 lanes have been uploaded in your internal pricing
    #     template
    #      If you want to change some columns please repeat step 2
    #     and step 3
    #      In Step4 Push Pricing
    #      Start and Skip buttons are displayed
    #************************************************************
    Log    Done in step 4

Step ${step} Click On Skip Button In Step4 In The Pop Up Skip Push
    #************************Step 6******************************
    #  Do:
    #      Click on Skip button in Step4 in the pop up Skip push
    #     pricing window click on Yes
    #  Expected:
    #      Summary Skip Successfully Please go to Round Management
    #     to continue
    #      Next Round Management button is displayed
    #************************************************************
    Push Skip and check for AIR Template

Step ${step} Click On Next Round Management Button
    #************************Step 7******************************
    #  Do:
    #      Click on Next Round Management button
    #  Expected:
    #      Round management window is pop up
    #************************************************************
    Wait Until Search Finished
    Wait Until Keyword Succeeds   20x    500ms    Get Element States    ${Template_gotoNextButton}    contains    visible
    Wait Until Keyword Succeeds    10x    100ms    Click    ${Template_gotoNextButton}
    Wait Until Search Finished
    Wait For Elements State    ${Project_RoundMgmt_SanityCheckButton}    enabled    60

Step ${step} Click On Sanity Check Button
    #************************Step 8******************************
    #  Do:
    #      Click on Sanity Check button
    #      Download Sanity Configuration check file
    #  Expected:
    #      The downloaded files should be the same as attachment
    #     index php attachments get 557771fb f648 465e 9b2e
    #     af6e7c6db429
    #************************************************************
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SanityCheckButton}
    Wait Until Search Finished
    ${SanityCheckfilename}    Download File    ${Project_RoundMgmt_SanityCheck_laneDownloadButton}
    Set Suite Variable    ${SanityCheckfilename}    ${SanityCheckfilename}
    Wait Until Search Finished

Step ${step} Close The Validation Setup Dialog
    #************************Step 9******************************
    #  Do:
    #      Close the Validation Setup dialog
    #      Set deadline for each region as current date
    #      Assign WENDJIAN as pricing lead of region APAC and NAM
    #  Expected:
    #      Assign successfully
    #************************************************************
    Click    ${Project_RoundMgmt_SanityCheck_CancelButton}
    ${Date}    Get Current Date    UTC    result_format=%d/%m/%Y
    Input Deadline In Region Tab    0    0    ${Date}
    Input Deadline In Region Tab    0    1    ${Date}
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_AssignButton}
    Wait For Elements State    ${Project_RoundMgmt_Assign_ApacTab}    visible    30
    Wait For Elements State    ${Project_RoundMgmt_Assign_ApacTab}    enabled    30
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_ApacTab}    xpath= //div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_NamTab}    xpath = //div[@class='shuttle-list ng-pristine ng-scope ng-isolate-scope ng-valid ng-valid-required']//b[.='Wendy Jiang (WENDJIAN)']


Step ${step} Click On Start Button
    #************************Step 10******************************
    #  Do:
    #      Click on Start button
    #      In the Are you sure to start round1 click on Yes button
    #      Click on Send button
    #  Expected:
    #      The window is closed
    #************************************************************
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    Click    ${Project_RoundMgmt_StartButton}
    Wait Until Keyword Succeeds    10x    100ms    Click    ${Project_RoundMgmt_StartConfirmButton} 
    Wait Until Search Finished
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished

Step ${step} Close The Window And Reopen It
    #************************Step 11******************************
    #  Do:
    #      Close the window and reopen it
    #      Change the Role to be Regional Pricing Manager APAC NAM
    #      Assign no user to be coutry and cluster pricing lead
    #     send notification
    #  Expected:
    #      Just wait a few seconds and a successful tip is
    #     appeared
    #************************************************************

    Click    ${Project_RoundMgmt_CloseButton}
    Close Browser
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Click    ${Project_toolbar_RoundMgmtButton}
    Wait For Elements State    ${Project_RoundMgmt_CurrentRole}    enabled    60
    Assign My Current Role    Regional Pricing Manager(NAM,APAC)
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_AssignButton}
    Wait For Elements State    xpath = //a[.='CN-C']    visible    30    
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    xpath = //a[.='CN-C']
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    xpath = //a[.='US']
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    xpath = //form[@name='assignmentForm']//a[.='Cluster']
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    xpath = //a[.='Greater China']
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Routing_Confirm_Approve}
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_SendNotifButton}
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished
Step ${step} Click On Download IPT Update The Rate Part In The File
    #************************Step 12******************************
    #  Do:
    #      Click on Download IPT update the rate part in the file
    #     as attachment index php attachments get e8e2bd47 3510
    #     4466 b7d4 7d4a07a9d071
    #      Click on Submission button
    #      Select all Segments in Step1
    #      Upload the updated file
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${IPT}    Download File    //button[.='Download IPT']
    Set Test Variable    ${IPT}    ${IPT}
    Wait Until Search Finished
    ${Step12TemplateFile}    Set Variable    Cases${/}FCL MODE${/}TestData${/}AUTO 90922-FCL-Regression Test by automation_Round2_IPT_11112024_dy.xlsx 
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step12TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        download the error report for more detail information

Step ${step} Download The Error Report 1
    #************************Step 13******************************
    #  Do:
    #      Download the Error Report
    #      Check the excel file content
    #  Expected:
    #      Should contain such kind of errors
    #      index php attachments get df04351d d4cd 4b19 ac4e
    #     dd43814245f4
    #************************************************************
    ${filename}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    # ${filename}    Get Download File Name    UploadReport
    Compare Excel Value    Cases${/}FCL MODE${/}TestData${/}UploadReport.xlsx_09112024_uc.xlsx
    ...   ${filename}    15    5    REPORT
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished
   

Step ${step} Update The Rate Part In The File As Attachment index 1
    #************************Step 14******************************
    #  Do:
    #      update the rate part in the file as attachment index
    #     php attachments get fdf8a9ff aded 498f 9567 df126008b142
    #      Upload the updated file
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${Step14TemplateFile}    Set Variable    Cases${/}FCL MODE${/}TestData${/}AUTO 90922-FCL-Regression Test by automation_Round2_IPT_11112024_dy111.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step14TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        download the error report for more detail information

Step ${step} Download The Error Report 2
    #************************Step 15******************************
    #  Do:
    #      Download the error report
    #  Expected:
    #      Should contain such kind of errors index php
    #     attachments get cec4f7a4 cce5 40a6 832f 23a01407382b
    #************************************************************
    ${filename}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    # ${filename}    Get Download File Name    UploadReport
    Compare Excel Value     Cases${/}FCL MODE${/}TestData${/}UploadReport.xlsx_09112024_Bp.xlsx
    ...   ${filename}    15    5    REPORT
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished
   

Step ${step} Update The Rate Part In The File As Attachment index 2
    #************************Step 16******************************
    #  Do:
    #      update the rate part in the file as attachment index
    #     php attachments get fb581485 1ba3 48c8 8479 162b1b946ed3
    #      Upload the updated file
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${Step16TemplateFile}    Set Variable    Cases${/}FCL MODE${/}TestData${/}AUTO 90922-FCL-Regression Test by automation_Round2_IPT_11112024_dy222.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step16TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        download the error report for more detail information


Step ${step} Download The Error Report 3
    #************************Step 17******************************
    #  Do:
    #      Download the error report
    #  Expected:
    #      Should contain such kind of errors index php
    #     attachments get 2424b72f 95d3 4f95 96b7 a6f7856cf4df
    #************************************************************
    ${filename}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    # ${filename}    Get Download File Name    UploadReport
    Compare Excel Value    Cases${/}FCL MODE${/}TestData${/}UploadReport.xlsx_09112024_9j.xlsx
    ...   ${filename}    15    5    REPORT
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished
    Close All Excel Documents
   

Step ${step} Update The Rate Part In The File As Attachment index 3
    #************************Step 18******************************
    #  Do:
    #      update the rate part in the file as attachment index
    #     php attachments get c79481c4 c0b6 4b99 830a a2067cfc342c
    #      Upload this file
    #  Expected:
    #      Summary SUCCESSFUL
    #      Your selected lanes have been uploaded
    #      Step3 Submit button is displayed
    #************************************************************
    ${Step18TemplateFile}    Set Variable     Cases${/}FCL MODE${/}TestData${/}AUTO 90922-FCL-Regression Test by automation_Round2_IPT_11112024_dy333.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step18TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    1s    Get Page Source    contains        SUCCESSFUL
    Wait Until Keyword Succeeds    10x    1s    Get Page Source    contains        Your selected lanes have been uploaded!

Step ${step} Click On Submit Button
    #************************Step 19******************************
    #  Do:
    #      Click on Submit button
    #  Expected:
    #      Summary SUCCESSFUL
    #      Your rates have been submitted
    #************************************************************
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SubmitButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        SUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        Your rates have been submitted!



Step ${step} Exchange Current Role To Project Owner
    #************************Step 20******************************
    #  Do:
    #      Exchange current role to Project Owner
    #      Click on Close Round button
    #      In pop up dialog
    #      Select Send notification to all pricing manager
    #      User clicks yes button
    #  Expected:
    #      1 A prompt says Close Success
    #      2 Current Pricing Round 1 Closed 2 lanes
    #      3 There have new round button and reopen round button
    #************************************************************
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished
    Wait For Elements State    ${Project_RoundMgmt_CurrentRole}    enabled    60
    Assign My Current Role    Project Owner
    Wait Until Search Finished
    Click    ${Project_RoundMgmt_CloseRoundButton}
    Wait Until Search Finished
    Click    //span[contains(text(),"Send notification to regional pricing manager.")]
    Click    //button[contains(text(),"Yes")]
    Wait Until Search Finished

Step ${step} Click On Close Button
    #************************Step 21******************************
    #  Do:
    #      Click on Close button
    #      In Pricing Project page User selects TenderID Contains
    #     20240815
    #  Expected:
    #      The project with FCL mode could be found
    #************************************************************
    Click    ${Project_RoundMgmt_CloseButton}
    Search Project    ${PROJECT.TENDER_ID}

Step ${step} Select This Project Click On Delete Project Button
    #************************Step 22******************************
    #  Do:
    #      Select this project click on Delete Project button
    #      Click Yes of the pop up confirm window
    #      If Delete Project button is disable do Data Cleaning
    #     and cancel first and then Delete Project button is
    #     enable
    #  Expected:
    #      System displays Project has been deleted
    #************************************************************
    Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_toolbar_DataCleaningButton}
    Click    //button[contains(., "Yes")]
    Wait For Elements State    ${Data_toolbar_UploadButton}    visible    30
    Click    ${Data_toolbar_CloseButton}
    Click    //button[contains(., "Yes")]
    Remove All Files
    Log    finish in 'tear Down'

Step ${step} User Goes To Basic Data Management Tender List
    #************************Step 23******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Search out the tender created in step1
    #      Click on Delete button
    #      Click on Yes button in the popup dialog
    #  Expected:
    #      System displays Tender has been deleted
    #************************************************************
    Log    finish in 'tear Down'

Data Cleaning_TC10
    [Arguments]    ${Select_By}=Location    ${DataCleaningTemplateFile}=${PROJECT.TEMPLATE}
    ${Modify_Value}    Set Variable    1
    # 1.User goes to Pricing Collaboration , Pricing Project
    # 2.User select the row
    Search Project    ${PROJECT.TENDER_ID}
    # 3.User clicks data cleaning button.
    Wait For Elements State    ${Project_toolbar_DataCleaningButton}    enabled    20
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_toolbar_DataCleaningButton}
    Wait Until Search Finished
    # 4.User clicks upload button.
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Data_toolbar_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${DataCleaningTemplateFile}
    Wait Until Search Finished
    Wait For Elements State    xpath=//input[@value='location']    visible    30    
    # Data Upload Template    ${PROJECT.TENDER_ID}-${PROJECT.MODE}-${PROJECT.TENDER_TITLE}    ${PROJECT.TEMPLATE}
    # 5.User select location/Port routing.
    IF    '${Select_By}' == 'Location'
            Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_DataClean_RoutingLocation}
    ELSE
            Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_DataClean_RoutingPort}
    END
    Wait For Elements State    ${FCL/AIR_Select_OriginCountry}    enabled    60
    Select Options By   ${FCL/AIR_Select_OriginCountry}    label    ${SPACE}${SPACE}country from - D    Country from - D
    Select Options By   ${FCL/AIR_Select_DestinationCountry}      label     ${SPACE}${SPACE}country to - G        Country to - I
    Select Options By   ${Origin_City}      label     ${SPACE}city from - C
    Select Options By   ${Destination_City}      label      ${SPACE}${SPACE}city to - F
    Select Options By   ${Origin_State}      label    State From - E    State from - E
    Select Options By   ${Destination_State}      label    State To - H
    Select Options By   ${Customer_Lane_ID}      label    Lane ID code - B
    Select Options By   ${Origin_Type}    label    origin type - I
    Select Options By   ${Destination_Type}      label    des type - J
    Select Options By   ${Origin_Postal_Code}      label    Origin Postal Code - K
    Select Options By   ${Destination_Postal_Code}      label    Destination Postal Code - L
    Select Options By   ${Customer_Deliver_Term}      label    Customer's\nDelivery\nTerm - M
    Select Options By   ${Volume_Containers_20}    label    Volume\nContainers\n20 - P
    Select Options By   ${Volume_Containers_40}    label    Volume\nContainers\n40 - Q
    Select Options By   ${Volume_Containers_40HC}    label    Volume\nContainers\n40HC - R
    Select Options By   ${Volume_Containers_45}    label    Volume Containers 45 - S
    Select Options By   ${Volume_TEU_Total}    label    Volume\nTEU\nTota - T
    Select Options By   ${Commodity_Desc}    label    Commodity\nDescription - U
    Select Options By   ${IMO_Class}    label    IMO Class - V
    Select Options By   ${IMO_UN_No}      label    IMO UN No. - W
    Select Options By   ${Customer_Port_of_Load}    label    Customer Port of Load - N
    Select Options By   ${Customer_Port_of_Discharge}    label    Customer Port of Discharge - O
    # Select Options By   ${Commodity_Remarks}     label    Commodity Remarks - W
    # 6.User clicks start button.
    Click    ${Data_toolbar_StartButton}
    Wait For Elements State    ${Summary_Succ}    visible    30
    Wait For Elements State   ${Data_toolbar_DownloadButton}     enabled
    Get Element States    ${Data_toolbar_UploadAfterStartButton}    not contains    disabled
    Get Element States    ${Data_toolbar_SetPassButton}    not contains    disabled

Template Management_TC10
    Wait Until Search Finished
    Wait Until Search Finished
    Wait For Elements State    ${Template_Step1DownloadButton}    visible    60
    Get Element States    ${Template_Step1DownloadButton}    not contains    disabled
    Wait For Elements State    ${Template_Dialogtitle}    visible    
    Check Text Value    ${Template_Dialogtitle}    ${PROJECT.TENDER_ID}-${PROJECT.MODE}-${PROJECT.TENDER_TITLE}
    Check Text Value    ${Template_Step2title}    Step2: Select and Define Optional Columns
    Check Text Value    ${Template_Step3title}    Step3: Generate Internal Pricing Template
    Check Text Value    ${Template_Step3DownloadFlag}    on
    Wait Until Search Finished
    # 4 User clicks download button.
    ${filename}    Download File    ${Template_Step1DownloadButton}
    # ${filename}    Get Download File Name    ${PROJECT.TENDER_ID}-${PROJECT.MODE}-${PROJECT.TENDER_TITLE}_DC    zip
    # # 5 Select Column 
    # Select Column for AIR Template
    Check All Check Box for Dialog    Step2: Select and Define Optional Columns
    Uncheck ALL TBN Checkbox    Step2: Select and Define Optional Columns
    # 6 User clicks start button.
    Wait Until Search Finished
    Click    ${Template_StartButton}
    Wait Until Search Finished
    Wait Until Search Finished
    Wait For Elements State    //span[contains(text(),'[2] lanes have been generated in your internal pricing template.')]    visible
    ${text}    Get Text    //span[contains(text(),'[2] lanes have been generated in your internal pricing template.')]
    Should Contain    ${text}    If you want to change some columns, please repeat step 2 and step 3.
    Click    //button[contains(.,'Upload')]
    Upload File By Selector    ${upload_addFileButton}    Cases${/}FCL MODE${/}${/}TestData${/}AUTO 69803-FCL-Regression Test by automation_IPT_01222025_zT.xlsx    
    Wait Until Keyword Succeeds    20x    400ms    Get Page Source    contains        100%
    # Check Text Value    ${Template_Summary}    Successful